﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class EditPwd : ATPages
{
    ZSql info = new ZSql();

    protected void Page_Load(object sender, EventArgs e)
    {
        lblHint.Text = "";
        lblMessage.Text = "";
    }

    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (txtPwd.Text.Trim() == string.Empty)
        {
            lblHint.Text = "密码不能为空";
            return;
        }
        else if (txtPwd.Text.Trim() != txtPwdS.Text.Trim())
        {
            lblMessage.Text = "两次输入密码不一致";
            return;
        }

        string pwd = Common.WebEncrypt(txtPwd.Text.Trim());

        info.Open("update userinfo set password = '" + Common.FormatParameter(pwd) + "' where userid = " + Request.Cookies["user"].Values["id"]);

        info.Close();

        ClientScript.RegisterStartupScript(this.GetType(), "over", "window.close()", true);
    }
}
